package xyz.xtt.admin.service.impl;

import cn.hutool.core.lang.Assert;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.xtt.admin.entity.TblActivity;
import xyz.xtt.admin.mapper.ActivityMapper;
import xyz.xtt.admin.service.IActivityService;

/**
 * @author Jim kwok
 * @since 2025/2/28
 */
@Service
public class ActivityServiceImpl extends MPJBaseServiceImpl<ActivityMapper, TblActivity> implements IActivityService {
    @Autowired
    ActivityMapper activityMapper;

    /**
     * 查询单个活动信息
     */
    public TblActivity getOneById(Long id) {
        MPJLambdaWrapper<TblActivity> query = new MPJLambdaWrapper<>();
        query.eq(TblActivity::getId, id);
        return activityMapper.selectOne(query);
    }

    /**
     * 添加一个活动
     */
    public Integer saveOne(TblActivity activity){
        Assert.notNull(activity);
        return activityMapper.insert(activity);
    }


}
